package org.outlook.crawler.database;

import java.util.List;
import java.util.Map;

import org.outlook.crawler.client.domain.Content;
import org.outlook.crawler.client.domain.ErrorReport;
import org.outlook.crawler.client.domain.Keyword;
import org.outlook.crawler.client.domain.Resource;
import org.outlook.crawler.client.domain.Source;
import org.outlook.crawler.client.pojo.ErrorType;
import org.springframework.transaction.annotation.Transactional;


public interface CrawlerDataSource {
	
	public Keyword getKeywordBySourceId(String keyword, long sourceId);

    @Transactional(readOnly = true)
    public List<Content> getContentBykeywordAndSourceId(String keyword, long sourceId);

    @Transactional(readOnly = true)
    public List<Content> getContentByKeyword(Keyword keyword);

    public Source getSourceById(long sourceId);

    public void saveKeywordAndContent(String keyword, long sourceId, List<Content> contentList);

    @Transactional
    public void saveKeyword(String keyword, Long sourceId);

    @Transactional
    public void deleteContentByKeywordAndSourceId(Keyword keyword);

    @Transactional
    public void saveContent(Content Content, Keyword keyword);

	public List<Map<String, String>> getContentsAndGenerateMap(Keyword keyword);

	public List<Resource> getSources();

	public Keyword getKeywordFresh(String keyword, long sourceId);

	public void deleteContentsAndKeywordByKeywordId(Long keywordId);

    public ErrorReport getErrorReport(String keyword, long sourceId);

    public void recordError(String keyword, long id, ErrorType errorType);

}
